<?php

declare(strict_types=1);

namespace ImiApp\ApiServer\Api\Model\Base;

use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use ImiApp\ImiServer\AbstractModel as Model;

/**
 * 运营中心系统分配会员奖金 基类.
 *
 * @Entity(camel=false, bean=true, incrUpdate=false)
 * @Table(name=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\RunBonusUserSys.name", default="fa_run_bonus_user_sys"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\RunBonusUserSys.poolName"))
 * @DDL(sql="CREATE TABLE `fa_run_bonus_user_sys` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned DEFAULT NULL,
  `run_id` int(10) unsigned DEFAULT NULL,
  `ratio` decimal(5,2) unsigned DEFAULT '0.00' COMMENT '比例',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='运营中心系统分配会员奖金'", decode="")
 *
 * @property int|null $id 
 * @property int|null $userId 
 * @property int|null $runId 
 * @property string|float|int|null $ratio 比例
 */
abstract class RunBonusUserSysBase extends Model
{
    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEY = 'id';

    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEYS = ["id"];

    /**
     * id.
     * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $id = NULL;

    /**
     * 获取 id.
     *
     * @return int|null
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * 赋值 id.
     * @param int|null $id id
     * @return static
     */
    public function setId($id)
    {
        $this->id = null === $id ? null : (int)$id;
        return $this;
    }

    /**
     * user_id.
     * @Column(name="user_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $userId = NULL;

    /**
     * 获取 userId.
     *
     * @return int|null
     */
    public function getUserId(): ?int
    {
        return $this->userId;
    }

    /**
     * 赋值 userId.
     * @param int|null $userId user_id
     * @return static
     */
    public function setUserId($userId)
    {
        $this->userId = null === $userId ? null : (int)$userId;
        return $this;
    }

    /**
     * run_id.
     * @Column(name="run_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $runId = NULL;

    /**
     * 获取 runId.
     *
     * @return int|null
     */
    public function getRunId(): ?int
    {
        return $this->runId;
    }

    /**
     * 赋值 runId.
     * @param int|null $runId run_id
     * @return static
     */
    public function setRunId($runId)
    {
        $this->runId = null === $runId ? null : (int)$runId;
        return $this;
    }

    /**
     * 比例.
     * ratio
     * @Column(name="ratio", type="decimal", length=5, accuracy=2, nullable=true, default="0.00", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var string|float|int|null
     */
    protected $ratio = NULL;

    /**
     * 获取 ratio - 比例.
     *
     * @return string|float|int|null
     */
    public function getRatio()
    {
        return $this->ratio;
    }

    /**
     * 赋值 ratio - 比例.
     * @param string|float|int|null $ratio ratio
     * @return static
     */
    public function setRatio($ratio)
    {
        $this->ratio = null === $ratio ? null : $ratio;
        return $this;
    }

}
